package cn.bdqn.xtxg.oof;

import java.util.Scanner;

public class MotoTest {
	public static void main(String[] args) {
		MotoVehicle motos[] = new MotoVehicle[4];
		Scanner input = new Scanner(System.in);
		String isNo = null;
		int totalRent=0;
		motos[0]=new Car("京A.66666","宝马",1);
		motos[1]=new Car("京A.88888","别克",2);
		motos[2]=new Bus("京A.22222","金龙",54);
		motos[3]=new Car("京A.99999","解放",24);
		int day;
		int i = 0;
		do {
			System.out.println("欢迎来到汽车租赁公司");
			System.out.println("请输入要租赁的天数");
			day = input.nextInt();
			System.out.println("请输入要租赁的汽车类型1.轿车2.客车");
			int moto = input.nextInt();

			switch (moto) {
			case 1:
				Car c = new Car();

				System.out.print("请输入要租赁的轿车品牌");
				System.out.println("1.宝马2.别克");
				int brand = input.nextInt();
				c.setBrand(brand);
				if (brand == 1) {
					c.setNo("京A.66666");
					System.out.println("请输入轿车型号1.宝马550i ");
					int type = input.nextInt();
					if (type == 1) {
						c.setType(1);
					}

				} else {
					c.setNo("京A.88888");
					System.out.println("请输入轿车型号2.商务车GL8 3.林萌大道");
					int type = input.nextInt();
					if (type == 1) {
						c.setType(2);
					} else {
						c.setType(3);
					}
				}
				System.out.println("为您分配的汽车牌号是" + c.getNo());
				System.out.println("顾客您好您此次的租车支付费用为"+c.calRent( day));
				i++;
				System.out.println("您还要租车吗Y/N");
				isNo = input.next();

				break;
			case 2:
				Bus b = new Bus();
				System.out.println("请输入要租赁的客车品牌");
				System.out.println("1.金杯2.金龙");
				int brand1 = input.nextInt();
				if (brand1 == 1) {
					b.setNo("京A.12345");
				} else {
					b.setNo("京A.45678");
				}
				System.out.println("请输入客车的座位数");
				b.setSeatCount(input.nextInt());
				System.out.println("为您分配的汽车牌号为" + b.getNo());
				System.out.println("顾客您好您此次的租车支付费用为"+b.calRent( day));
				i++;
				System.out.println("您还要租车吗Y/N");
				isNo = input.next();
				break;
			}
			if(i==5)
			{
				System.out.println("抱歉一人只能最多租5辆车");
			}
		} while (isNo.equals("Y") && i != 5);
		System.out.println("谢谢光临");
		Custemer cus=new Custemer();
		System.out.println("汽车牌号\t\t品牌");
		for (int c = 0; c < motos.length; c++) {
			System.out.println(motos[c].getNo()+"\t"+motos[c].getName());
		}
		System.out.println("您本次租车天数为"+day);
		System.out.println("顾客您好您本次的总租车费用为"+cus.calcTotalRent(motos, day)); 
	}
}
